//
//  HomePageTitleScoller.m
//  MeiChu
//
//  Created by 黄景川 on 16/1/13.
//  Copyright © 2016年 黄景川. All rights reserved.
//

#import "HomePageTitleScoller.h"

@implementation HomePageTitleScoller


-(void)awakeFromNib{
    
    _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    
    [self addSubview:_scrollView];
    
    _buttonView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    
    [_scrollView addSubview:_buttonView];
    
    [self images];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


//添加图片
-(void)images{
    
    
    UIBezierPath* bezierPath = [UIBezierPath bezierPath];
    
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    
    [bezierPath moveToPoint: CGPointMake(0, 0)];
    [bezierPath addLineToPoint: CGPointMake(0, 0)];
    [bezierPath addLineToPoint: CGPointMake(300, 0)];
    [bezierPath addLineToPoint: CGPointMake(300, 120)];
    [bezierPath addLineToPoint: CGPointMake(0, 110)];
    
    
    maskLayer.path = [bezierPath CGPath];
    
    UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(10, 0, 320, 200)];
    
    [btn setImage:[UIImage imageNamed:@"叉烧酱排骨.jpg"] forState:UIControlStateNormal];
    
    btn.layer.masksToBounds = YES;
    
    btn.layer.mask = maskLayer;
    
    [_buttonView addSubview:btn];
    
}


@end
